/** 使background 代码不停止运行 */
async function createOffscreen() {
  await chrome.offscreen.createDocument({
    url: '@public/offscreen/offscreen.html',
    reasons: [chrome.offscreen.Reason.BLOBS],
    justification: 'keep service worker running',
  }).catch(() => {});
  console.log('createOffscreen keepAlive')
}
chrome.runtime.onStartup.addListener(createOffscreen);
self.onmessage = e => {console.log('createOffscreen keepAlive onmessage')}; // keepAlive
createOffscreen();